import Vue from 'vue'
import Vuex from 'vuex'
import tabBarStore from './modules/tabBar.js'
import user from './modules/user.js'
import cascade from './modules/cascade.js'
import getters from './getters.js'
import actions from './actions.js'
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)

const store = new Vuex.Store({
	modules: {
		tabBarStore,
		user,
		cascade
	},
	state: {},
	mutations: {},
	actions: actions,
	getters: getters,
	plugins: [
		// 方法一 存储所有的state状态
		createPersistedState({
			storage: localStorage, // 存储方式：localStorage、sessionStorage、cookies
			key: "store", // 存储的的key
		}),
	],
})

export default store